using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMFaltas
    {
        public BMFaltas(string coneccion) 
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Faltas oFalta = new Faltas();
        private List<Faltas> listFaltas = new List<Faltas>();
        private DAFaltas daFaltas = new DAFaltas();

        #region BMFaltasGetAllByEmpleado
        public List<Faltas> BMFaltasGetAllByEmpleado(Faltas falta)
        {
            try
            {
                listFaltas = daFaltas.DAFaltasGetAllByEmpleado(Connection, falta);
                return listFaltas;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMFaltasInsert
        public Faltas BMFaltasInsert(Faltas falta)
        {
            try
            {
                falta = daFaltas.DAFaltasInsert(Connection, falta);
                return falta;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMFaltasUpdateEstado
        public void BMFaltasUpdateEstado(Faltas falta)
        {
            try
            {
                daFaltas.DAFaltasUpdateEstado(Connection, falta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMFaltasDelete
        public void BMFaltasDelete(Faltas falta)
        {
            try
            {
                daFaltas.DAFaltasDelete(Connection, falta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMFaltasSearch
        public List<Faltas> BMFaltasSearch(Faltas faltaD, Faltas faltaH)
        {
            try
            {
                listFaltas = daFaltas.DAFaltasSearch(Connection, faltaD, faltaH);
                return listFaltas;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}


